package com.ruoyi.flowable.controller;

import java.util.List;

import com.ruoyi.flowable.service.impl.EndbilltraceServiceImpl;
import com.ruoyi.flowable.service.impl.EndedBillServiceImpl;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.flowable.domain.Endbilltrace;
import com.ruoyi.flowable.service.IEndbilltraceService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 已完成的工作票轨迹Controller
 *
 * @author ruoyi
 * @date 2022-07-26
 */
@RestController
@RequestMapping("/flowable/endbilltrace")
public class EndbilltraceController extends BaseController
{
    @Autowired
    private IEndbilltraceService endbilltraceService;

    /**
     * 查询已完成的工作票轨迹列表
     */
    @PreAuthorize("@ss.hasPermi('flowable:endbilltrace:list')")
    @GetMapping("/list")
    public TableDataInfo list(Endbilltrace endbilltrace)
    {
        startPage();
        List<Endbilltrace> list = endbilltraceService.selectEndbilltraceList(endbilltrace);
        return getDataTable(list);
    }

    /**
     * 导出已完成的工作票轨迹列表
     */
    @PreAuthorize("@ss.hasPermi('flowable:endbilltrace:export')")
    @Log(title = "已完成的工作票轨迹", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Endbilltrace endbilltrace)
    {
        List<Endbilltrace> list = endbilltraceService.selectEndbilltraceList(endbilltrace);
        ExcelUtil<Endbilltrace> util = new ExcelUtil<Endbilltrace>(Endbilltrace.class);
        return util.exportExcel(list, "endbilltrace");
    }

    /**
     * 获取已完成的工作票轨迹详细信息
     */
    @PreAuthorize("@ss.hasPermi('flowable:endbilltrace:query')")
    @GetMapping(value = "/{activityId}")
    public AjaxResult getInfo(@PathVariable("activityId") Long activityId)
    {
        return AjaxResult.success(endbilltraceService.selectEndbilltraceById(activityId));
    }

    /**
     * 新增已完成的工作票轨迹
     */
    @PreAuthorize("@ss.hasPermi('flowable:endbilltrace:add')")
    @Log(title = "已完成的工作票轨迹", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Endbilltrace endbilltrace)
    {
        return toAjax(endbilltraceService.insertEndbilltrace(endbilltrace));
    }

    /**
     * 修改已完成的工作票轨迹
     */
    @PreAuthorize("@ss.hasPermi('flowable:endbilltrace:edit')")
    @Log(title = "已完成的工作票轨迹", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Endbilltrace endbilltrace)
    {
        return toAjax(endbilltraceService.updateEndbilltrace(endbilltrace));
    }

    /**
     * 删除已完成的工作票轨迹
     */
    @PreAuthorize("@ss.hasPermi('flowable:endbilltrace:remove')")
    @Log(title = "已完成的工作票轨迹", businessType = BusinessType.DELETE)
	@DeleteMapping("/{activityIds}")
    public AjaxResult remove(@PathVariable Long[] activityIds)
    {
        return toAjax(endbilltraceService.deleteEndbilltraceByIds(activityIds));
    }



}
